using System;
using Godot;

class TileMapUtil
{
	public static Vector2 TileSize = new Vector2(30, 30);

	//----------------------------------坐标转换-----------------------------------------//
	public static Vector2I ChangePosToTile(float x, float y)
	{
		Vector2I result = new Vector2I();
		result.X = (int)Math.Floor(x / TileSize.X);
		result.Y = (int)Math.Floor(y / TileSize.Y);
		return result;
	}

	public static Vector2 ChangePosToTilePos(Vector2 pos)
	{
		Vector2I tile = ChangePosToTile(pos.X, pos.Y);
		return new Vector2(tile.X * TileSize.X, tile.Y * TileSize.Y);
	}
}



